
let name = '张三'

let key = '自定义的key'

let person = {
  // key: 'value',
  [key]: 'value',
  // name: name,
  name,
  age: 23,
  // method: function () {
  method() {}
}

// console.log({...'hello'})
// console.log({...person})
// const person2 = {...person}
// person2.name = '李四'

// console.log(person)
// console.log(person2)

// const { name: n, ...oth } = person
// console.log(n)
// console.log(oth)








const arr = ['奥迪', '奔驰', '宝马', '丰田', ]
const arr1 = ['雪佛兰', '通用']
const arr2 = ['别克']

let arrs = [
  [
    [1, 2],
    [3, 4],
  ],
  [
    [1, 2],
    [3, 4],
  ],
  [
    [1, 2],
    [3, 4],
  ],
]

// console.log(arrs)
// console.log(arrs.flat(2))
// console.log(arrs.flat(Infinity))


/*
for (let item of arr.keys()) {
  console.log(item)
}
console.log(arr.values())
console.log(arr.entries())*/

// console.log(arr.fill('hello', 0, 2))
// console.log(new Array(20).fill({}))
// console.log(new Array(20).fill(undefined))
// console.log(new Array(20).fill(null))

// console.log(arr.fill('hello'))
// console.log(arr.copyWithin(1, 3))
// console.log(arr.copyWithin(0, 3))
// console.log(arr.copyWithin(0, 2))


// console.log(Array.of('item1', 'item2', 'item3'))
// console.log([].concat('item1', 'item2', 'item3'))

// const str = 'hello array'
// console.log([...str])
// console.log(str.split(''))

// 合并数组
// console.log([...arr1, ...arr2, ...arr])
// console.log(arr.concat(arr2, arr1))
// console.log([].concat(arr, arr2, arr1))


// const all = document.querySelectorAll('*')
// 类数组 转 数组
// const all2 = [...all]
// const all2 = Array.from(all)
// const all2 = [].slice.call(all)
// all2.push(123)
// console.log(all2)

/*
const arr = ['奥迪', '奔驰', '宝马', '丰田']
// 拷贝数组
const arr1 = [...arr]
const [...arr2] = arr
const arr3 = arr.concat()

console.log(arr)
console.log(arr1)
console.log(arr2)
console.log(arr3)
*/

// const [a, ...oth] = arr
// console.log(a)
// console.log(oth)
// console.log([...arr])






